#include <jni.h>
#include <string>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/ptrace.h>
#include <android/log.h>
extern "C" JNIEXPORT jboolean JNICALL
Java_cn_com_jni_proxy_1core_Utils_stringFromJNI(
        JNIEnv *env,
        jobject /* this */) {
    FILE* f = fopen("/proc/self/status", "r");
    char buf[1024];
    while(fgets(buf, 1024, f)) {
        if(strstr(buf, "TracerPid:")) {
            int tpid;
            sscanf(buf, "TracerPid: %d", &tpid);
            //LOGD("tracerpid: %d, pid:%d\n", tpid, getpid());
            if(tpid != 0) {
                fclose(f);
                return true;
            }
        }
    }
    fclose(f);
    return false;
}
